using System;

namespace OsHelper.DebugTools.LogService
{
	/// <summary>
	/// Write log messages to the console.
	/// </summary>
	public class ConsoleService : iService
	{
		///<summary>
		/// Contains the bitwise combined log levels to write.
		///</summary>
		///<value>
		/// A bitwise combined <see cref="LogLevel" /> specifying the
		/// levels of events to log.
		///</value>
		public LogLevel Level = LogLevel.Standard;
		
		public ConsoleService () { }
		
		public override void Write (LogLevel level, string message)
		{
			if ((this.Level & level) == LogLevel.None)
				return;
			
			string text = string.Format ("[{0:u}, {1}] {2}",
			                             DateTime.Now.ToString(), level, message);
				Console.WriteLine (text);
		}
	}
}

